﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MSBDATAModel;

public partial class KHDefault : System.Web.UI.Page
{
    MSBDATAEntities entities = new MSBDATAEntities();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["login"] != null)
        {
            string username = Session["login"].ToString();

            var matches = from tk in entities.TAI_KHOAN_WEB
                          where tk.TenDangNhap == username
                          select tk;
            try {
                TAI_KHOAN_WEB tk = matches.First();
                if (tk.DuocKichHoat == true)
                    this.LabelWelcome.Text = "Chào " + tk.Ten + ",";
                else
                {
                    this.LabelWelcome.Text = "Bạn chưa kích hoạt tài khoản.";
                    this.LabelNoiDung.Text = "";
                }
            }
            catch (Exception) {
                Response.Redirect("NotLogin.aspx");
            }   
        }
        else
            Response.Redirect("NotLogin.aspx");
    }
}